Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Poseidon2-based Sponge function #713

Merged
merged 5 commits into from
Dec 14, 2024
Merged

feat: Poseidon2-based Sponge function #713

merged 5 commits into from
Dec 14, 2024

Conversation

alxiong
Copy link
Contributor

@alxiong alxiong commented Dec 13, 2024

Part of: #709 (Item 1 and 3)

This PR:

  • Implement a generic P2-based Sponge struct which implements nimue's trait Sponge
  • Concretely instantiate DuplexSponge for all the parameters we have (including various rate, given the same state size)
  • Add tests for all (both functional correctness as sponge used in transcript, and a naive statistical tests that output of these sponge-squeezed bytes are close to uniform distribution)

Caveats:

nimue-v0.1.0 which is the only published version, has compilation error, which I have reported upstream and help submit a PR to fix it.
I will push for a release tag of 0.1.1 from the upstream and later repin our nimue dependency, for now, I'm pointing to my own fork/branch


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (main)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added relevant changelog entries to the CHANGELOG.md of touched crates.
  • Re-reviewed Files changed in the GitHub PR explorer

@alxiong alxiong requested a review from mrain as a code owner December 13, 2024 13:53
@alxiong alxiong changed the title Implement Poseidon2-based Sponge function feat: Poseidon2-based Sponge function Dec 13, 2024
@alxiong
Copy link
Contributor Author

alxiong commented Dec 13, 2024

I have no clue about the CI error, firstly we didn't use getrandom 0.2.15, (in my local cargo.lock, we only depends on 0.2.12); secondly, that error shouldn't come from any of my changes.

We can safely review the code and ignore this error for now. (I will figure it out later)

@@ -24,7 +24,7 @@ displaydoc = { workspace = true }
hashbrown = { workspace = true }
hex = "0.4.3"
itertools = { workspace = true, features = ["use_alloc"] }
jf-poseidon2 = { path = "../poseidon2" }
jf-poseidon2 = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also have a version number bump for jf-merkle-tree after CRHF is done?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I'll introduce the CRHF in the next PR, then another one after that to bump jf-merkle-tree

mrain
mrain previously approved these changes Dec 13, 2024
Copy link
Contributor

@mrain mrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@alxiong alxiong merged commit fdd8e44 into main Dec 14, 2024
5 checks passed
@alxiong alxiong deleted the p2-sponge branch December 14, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants